var HOST = $('body').attr('data-host');

$(function () {
    $('.clockpicker').clockpicker();

    $('input').keydown(function () {
        $('#insert_info').removeAttr('disabled');
    });

    $('#insert_info').click(function () {
        $("#insert_info").attr('disabled', 'disabled');
        $.ajax({
            type: "POST",
            url: HOST + "/companys.info/insert_info",
            data: $('.form-horizontal').serialize(),// 你的formid
            async: false,
            success: function (data) {
                if (data.info == 1) {
                    $("#insert_info").removeAttr('disabled');
                    toastr.success('保存成功');
                } else {
                    toastr.success('发生异常');
                }

            }
        });
    });

    $.get(HOST + '/companys.info/getCompany_logo', function (img) {
        _SetLogo_model({
            id: '#setCompany_logo',
            img: img,
            success: function (key) {
                $.ajax({
                    type: 'post',
                    url: HOST + '/companys.info/setCompany_logo',
                    data: {
                        key: key
                    },
                    dataType: 'json',
                    success: function (e) {
                        if (!e.state) {
                            toastr.error('保存失败!', '请联系程序猿修复 >_<!');
                        }
                    }
                });
                return true;
            }
        });
    });

});
